import { createSlice, PayloadAction } from '@reduxjs/toolkit';

interface IState {
  currentSongs: {
    album?: any;
    playlist?: any;
    size?: number;
    playCount?: number;
    songs?: any[];
    id?: number;
    single?: any;
    description?: any;
    picUrl?: any;
    name?: any;
  };
  kind: string;
}
const initialState: IState = {
  currentSongs: {},
  kind: '',
};

const DetailSlice = createSlice({
  name: 'detail',
  initialState,
  reducers: {
    setCurrentSongs: (state, { payload }) => {
      state.currentSongs = payload;
    },
    setKind: (state, { payload }: PayloadAction<string>) => {
      state.kind = payload;
    },
  },
});

export const { setCurrentSongs, setKind } = DetailSlice.actions;

export default DetailSlice.reducer;
